#Makefile

include ../config.mak
include sub.mak

all: libicommon.a

#libicommon.a
INCLUDES = ${INCLUDE_COMMON} -Iinclude
LDFLAGS = -lpthread -lm
CFLAGS = ${CFLAGS_COMMON} $(INCLUDES) -Wall -mmxu2 -flax-vector-conversions

OBJS = $(OBJS-$(ICOMMON))

ifeq (${IMP_MALLOC}, y)
OBJS += ${ISVP_ENV_SDK_DIR}/src/imp/syswrapper/imp_mem.o \
		${ISVP_ENV_SDK_DIR}/src/imp/config/config.o \
		${ISVP_ENV_SDK_DIR}/src/imp/cJSON/cJSON.o
endif

$(OBJS):%.o:%.c
	$(CC) -c $(CFLAGS) -o $@ $<

#libicommon.a: $(OBJS) ${LIBEXTRACOMMON}
#	$(LD) -EL -o $@ -r -Bstatic $(OBJS) ${LIBEXTRACOMMON}

libicommon.a: $(OBJS)
	$(LD) -EL -o $@ -r -Bstatic $(OBJS)

.PHONY: clean distclean
clean:
	-rm -f $(OBJS)

distclean: clean
	-rm -f libicommon.a
